package org.example.controller;

import org.example.domain.dto.Condition;
import org.example.model.Result;
import org.example.service.IOrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RequestMapping("/order")
@RestController
@CrossOrigin("*")
public class OrderController {

    private IOrderService orderService;

    public OrderController(IOrderService orderService) {
        this.orderService = orderService;
    }

    //根据条件查询订单信息，当查询条件都为“”时查询所有订单
    //Condition中封装了所有的查询条件
    @PostMapping("/search")
    public Result findOrder(@RequestBody Condition condition){
        return Result.buildSuccess(orderService.finOrder(condition));
    }
}
